package cn.iocoder.yudao.module.polling.dal.mysql.pollingcategories;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.polling.controller.admin.pollingcategories.vo.EquInVo;
import cn.iocoder.yudao.module.polling.controller.admin.pollingcategories.vo.EquVo;
import cn.iocoder.yudao.module.polling.controller.admin.pollingcategories.vo.PollingCategoriesExportReqVO;
import cn.iocoder.yudao.module.polling.controller.admin.pollingcategories.vo.PollingCategoriesPageReqVO;
import cn.iocoder.yudao.module.polling.dal.dataobject.pollingcategories.PollingCategoriesDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 适用类别 Mapper
 *
 * @author 左达成
 */
@Mapper
public interface PollingCategoriesMapper extends BaseMapperX<PollingCategoriesDO> {

    default PageResult<PollingCategoriesDO> selectPage(PollingCategoriesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PollingCategoriesDO>()
                .betweenIfPresent(PollingCategoriesDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(PollingCategoriesDO::getTypeName, reqVO.getTypeName())
                .eqIfPresent(PollingCategoriesDO::getTypeDemand, reqVO.getTypeDemand())
                .eqIfPresent(PollingCategoriesDO::getTypeState, reqVO.getTypeState())
                .orderByDesc(PollingCategoriesDO::getId));
    }

    default List<PollingCategoriesDO> selectList(PollingCategoriesExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PollingCategoriesDO>()
                .betweenIfPresent(PollingCategoriesDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(PollingCategoriesDO::getTypeName, reqVO.getTypeName())
                .eqIfPresent(PollingCategoriesDO::getTypeDemand, reqVO.getTypeDemand())
                .eqIfPresent(PollingCategoriesDO::getTypeState, reqVO.getTypeState())
                .orderByDesc(PollingCategoriesDO::getId));
    }

    List<EquVo> selectAllEmp(int typeId);

    List<EquVo> selectAllEmpType();

    List<EquVo> selectUserByAll(String emqName);

    List<EquInVo> selectEquByBzId(EquInVo equInVo);

}
